package com.example.menulhd;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private String[] names={"食物11","食物12"};
    private String[] sales1={"销量11","食物12"};
    private String[] prices1={"售价11","售价12"};
    private int[] imgs={R.drawable.recom_one,R.drawable.recom_two};


    private String[] names2={"食物21","食物22"};
    private String[] sales2={"销量21","食物22"};
    private String[] prices2={"售价21","售价22"};
    private int[] imgs2={R.drawable.must_buy_one,R.drawable.must_buy_two};
   private TextView tv_recommand,tv_must_buy;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setData();
        init();
    }
private void clickEvent(){
        tv_recommand.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view){
                FragmentManager fm=getSupportFragmentManager();
                FragmentTransaction transaction=fm.beginTransaction();
            }
        });
        tv_must_buy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                
            }
        });
}
    private void init() {
        FragmentManager fm=getSupportFragmentManager();
        Fragment fragment =fm.findFragmentById(R.id.left);
        tv_recommand=fragment.getView().findViewById(R.id.tv_recommend);
        tv_must_buy=fragment.getView().findViewById(R.id.tv_must_buy);
    }

    private void setData(){
        HashMap map=new HashMap<>();
        List<FoodBean>list1=new ArrayList<>();
        List<FoodBean>list2=new ArrayList<>();
        for(int i=0;i<names.length;i++){
            FoodBean foodBean=new FoodBean();
            foodBean.setImg(imgs2[i]);
            foodBean.setName(names2[i]);
            foodBean.setPrice(prices2[i]);
            foodBean.setSales(sales2[i]);
            list2.add(foodBean);


        }
    }
}